<?php

$support = <<< SUPPORT
<div class="wrap">
<p>Please refer to documentation page of this site's demo to know how to use theme options specific to this theme. For professional support about customization and other advices from theme author, Please <a href="http://www.webulousthemes.com/?add-to-cart=33">Upgrade</a> to StrongHold Pro Version</p>
</div>
SUPPORT;

$page_builder = __( 'Page Builder', 'stronghold' );
$page_builder_details = __( 'StrongHold Pro supports Page Builder. All our shortcodes can be used as widgets too. You can drag and drop our widgets with page builder visual editor.', 'stronghold' );
$page_layout = __( 'Page Layout', 'stronghold' );
$page_layout_details = __( 'StrongHold Pro offers many different page layouts so you can quickly and easily create your pages with various layout without any hassle!', 'stronghold' );
$unlimited_sidebar = __( 'Unlimited Sidebar', 'stronghold' );
$unlimited_sidebar_details = __( 'Unlimited sidebars allows you to create multiple sidebars. Check out our demo site to see how different pages displays different sidebars!', 'stronghold' );
$shortcode_builder = __( 'Shortcode Builder', 'stronghold' );
$shortcode_builder_details = __( 'With our shortcode builder and lots of shortcodes, you can easily create nested shortcodes and build custom pages!', 'stronghold' );
$portfolio = __( 'Multi Portfolio', 'stronghold' );
$portfolio_details = __( '7 portfolio layouts with Isotope filtering, 3 blog layouts and multiple other alternate layouts for interior pages!', 'stronghold' );
$typography = __( 'Typography', 'stronghold' );
$typography_details = __( 'StrongHold Pro loves typography, you can choose from over 500+ Google Fonts and Standard Fonts to customize your site!', 'stronghold' );
$slider = __( 'Awesome Sliders', 'stronghold' );
$slider_details = __( 'StrongHold Pro includes two types of slider. You can use both Flex and Elastic sliders anywhere in your site.', 'stronghold' );
$woocommerce = __( 'Woo Commerce', 'stronghold' );
$woocommerce_details = __( 'StrongHold Pro has full design/code integration for WooCommerce, your shop will look as good as the rest of your site!', 'stronghold' );
$custom_widget = __( 'Custom Widget', 'stronghold' );
$custom_widget_details = __( 'We offer many custom widgets that are stylized and ready for use. Simply drag &amp; drop into place to activate!', 'stronghold' );
$advanced_admin = __( 'Advanced Admin', 'stronghold' );
$advanced_admin_details = __( 'Advanced Redux Framework for theme options panel, you can customize any part of your site quickly and easily!', 'stronghold' );
$font_awesome = __( 'Font Awesome', 'stronghold' );
$font_awesome_details = __( 'Font Awesome icons are fully integrated into the theme. Use them anywhere in your site in 6 different sizes!', 'stronghold' );
$responsive_layout = __( 'Responsive Layout', 'stronghold' );
$responsive_layout_details = __( 'StrongHold Pro is fully responsive and can adapt to any screen size. Resize your browser window to view it!', 'stronghold' );
$testimonials = __( 'Testimonials', 'stronghold' );
$testimonials_details = __( 'With our testimonial post type, shortcode and widget, Displaying testimonials is a breeze.', 'stronghold' );
$social_media = __( 'Social Media', 'stronghold' );
$social_media_details = __( 'Want your users to stay in touch? No problem, StrongHold Pro has Social Media icons all throughout the theme!', 'stronghold' );
$google_map = __( 'Google Map', 'stronghold' );
$google_map_details = __( 'StrongHold Pro includes Goole Map as shortcode and widget. So, you can use it anywhere in your site!', 'stronghold' );


$why_upgrade = <<< FEATURES
<p class="wrap-header">
    <a class="view-demo" href="http://demo.webulous.in/stronghold/">
        <i class="fa fa-eye"></i> View Demo</a> 
    <a class="upgrade" href="http://www.webulousthemes.com/?add-to-cart=33">
        <i class="fa fa-upload"></i> Upgrade To Pro</a>
</p>
<div class="one-third column clear">
    <div class="icon-wrap"><i class="fa  fa-5x fa-cog"></i></div>
    <h3>$page_builder</h3>
    <p>$page_builder_details</p>
</div>
<div class="one-third column">
    <div class="icon-wrap"><i class="fa  fa-5x fa-th-large"></i></div>
    <h3>$page_layout</h3>
    <p>$page_layout_details</p>
</div>
<div class="one-third column">
    <div class="icon-wrap"><i class="fa  fa-5x fa-th"></i></div>
    <h3>$unlimited_sidebar</h3>
    <p>$unlimited_sidebar_details</p>
</div>
<div class="one-third column clear">
    <div class="icon-wrap"><i class="fa  fa-5x fa-code-fork"></i></div>
    <h3>$shortcode_builder</h3>
    <p>$shortcode_builder_details</p>
</div>
<div class="one-third column">
    <div class="icon-wrap"><i class="fa  fa-5x fa-camera"></i></div>
    <h3>$portfolio</h3>
    <p>$portfolio_details</p>
</div>
<div class="one-third column">
    <div class="icon-wrap"><i class="fa  fa-5x fa-font"></i></div>
    <h3>$typography</h3>
    <p>$typography_details</p>
</div>
<div class="one-third column clear">
    <div class="icon-wrap"><i class="fa  fa-5x fa-slideshare"></i></div>
    <h3>$slider</h3>
    <p>$slider_details</p>
</div>
<div class="one-third column">
    <div class="icon-wrap"><i class="fa  fa-5x fa-leaf"></i></div>
    <h3>$woocommerce</h3>
    <p>$woocommerce_details</p>
</div>
<div class="one-third column">
    <div class="icon-wrap"><i class="fa  fa-5x fa-tasks"></i></div>
    <h3>$custom_widget</h3>
    <p>$custom_widget_details</p>
</div>
<div class="one-third column clear">
    <div class="icon-wrap"><i class="fa  fa-5x fa-dashboard"></i></div>
    <h3>$advanced_admin</h3>
    <p>$advanced_admin_details</p>
</div>
<div class="one-third column">
    <div class="icon-wrap"><i class="fa  fa-5x fa-magic"></i></div>
    <h3>$font_awesome</h3>
    <p>$font_awesome_details</p>
</div>
<div class="one-third column">
    <div class="icon-wrap"><i class="fa  fa-5x fa-arrows"></i></div>
    <h3>$responsive_layout</h3>
    <p>$responsive_layout_details</p>
</div>
<div class="one-third column clear">
    <div class="icon-wrap"><i class="fa  fa-5x fa-magic"></i></div>
    <h3>$testimonials</h3>
    <p>$testimonials_details</p>
</div>
<div class="one-third column">
    <div class="icon-wrap"><i class="fa  fa-5x fa-twitter"></i></div>
    <h3>$social_media</h3>
    <p>$social_media_details</p>
</div>
<div class="one-third column">
    <div class="icon-wrap"><i class="fa  fa-5x fa-map-marker"></i></div>
    <h3>$google_map</h3>
    <p>$google_map_details</p>
</div>
FEATURES;

function wbls_theme_page() {
    add_theme_page( 
    'Upgrade To StrongHold Pro',
    'Theme Upgrade',
    'edit_theme_options',
    'wbls_upgrade',
    'wbls_display_upgrade'
    );
}

add_action('admin_menu','wbls_theme_page');


function wbls_display_upgrade() {
    global $why_upgrade;
    echo '<div class="wrap">';
    echo $why_upgrade;
    echo '</div>';
}

    $options = array(
        'capability' => 10,
        'type' => 'theme_mod',
        'root' => array(
            'sections' => array(
                'upgrade' => array(
                    'title' => __('Upgrade to Pro', 'stronghold'),
                    'description' => __('Drag and Drop Page Builder support and more options available in Pro version. <a href="http://www.webulousthemes.com/?add-to-cart=33">Upgrade Now</a>', 'stronghold'),
                    'priority' => 9,
                    'fields' => array(
                        'color_scheme' => array(
                            'type' => 'disabled-select',
                            'label' => __('Select Color Scheme', 'stronghold'),
                            'choices' => array(
                                '1' => __('Red', 'stronghold'),
                                '2' => __('Green', 'stronghold'),
                                '3' => __('Blue', 'stronghold'),
                            ),
                            'default' => 0,
                            
                        ),
                    ),                      
                ),
            ),
        ),
        'panels' => array(
            'stronghold' => array(
                'priority'       => 9,
                'title'          => __('StrongHold Options', 'stronghold'),
                'description'    => __('StrongHold Theme Options', 'stronghold'),
                'sections' => array(
                    'general' => array(
                        'title' => __('General', 'stronghold'),
                        'description' => __('General settings that affects overall site', 'stronghold'),
                        'fields' => array(
                            'breadcrumb' => array(
                                'type' => 'checkbox',
                                'label' => __('Enable Breadcrumb', 'stronghold'),
                                'default' => 0,
                                'sanitize_callback' => 'boolean',
                            ),
                            'breadcrumb_char' => array(
                                'type' => 'select',
                                'label' => __('Select Breadcrumb Character', 'stronghold'),
                                'choices' => array(
                                    '1' => '&raquo;',
                                    '2' => ' / ',
                                    '3' => ' > '
                                ),
                                
                                'default' => '1',
                            ),
                        ),
                    ),
                    'header' => array(
                        'title' => __('Header', 'stronghold'),
                        'description' => __('Header options', 'stronghold'),
                        'fields' => array(
                            'logo_title' => array(
                                'type' => 'checkbox',
                                'label' => __('Logo as Title', 'stronghold'),
                                'default' => 0,
                                'sanitize_callback' => 'boolean',
                            ),
                            'logo' => array(
                                'type' => 'image',
                                'label' => __('Upload Logo', 'stronghold'),
                                'sanitize_callback' => 'esc_url_raw',
                            ),
                            'tagline' => array(
                                'type' => 'checkbox',
                                'label' => __('Show site Tagline', 'stronghold'),
                                'default' => 0,
                                'sanitize_callback' => 'boolean',
                            ),
                        ),
                    ),
                    'footer' => array(
                        'title' => __('Footer', 'stronghold'),
                        'description' => __('Footer related options', 'stronghold'),
                        'fields' => array(
                            'footer_widgets' => array(
                                'type' => 'checkbox',
                                'label' => __('Footer Widget Area', 'stronghold'),
                                'default' => 0,
                                'sanitize_callback' => 'boolean',
                            ),
                        ),
                    ),
                    'home' => array(
                        'title' => __('Home', 'stronghold'),
                        'description' => __('Home Page options', 'stronghold'),
                        'fields' => array(
                            'slider_cat' => array(
                                'type' => 'category',
                                'label' => __('Slider Posts Category', 'stronghold'),
                                'sanitize_callback' => 'absint',
                            ),
                            'slider_count' => array(
                                'type' => 'text',
                                'label' => __('No. of Sliders', 'stronghold'),
                                'sanitize_callback' => 'absint',
                            ),
                            'service_1' => array(
                                'type' => 'dropdown-pages',
                                'label' => __('Service Section #1', 'stronghold'),
                                'sanitize_callback' => 'absint',
                            ),
                            'service_2' => array(
                                'type' => 'dropdown-pages',
                                'label' => __('Service Section #2', 'stronghold'),
                                'sanitize_callback' => 'absint',
                            ),
                            'service_3' => array(
                                'type' => 'dropdown-pages',
                                'label' => __('Service Section #3', 'stronghold'),
                                'sanitize_callback' => 'absint',
                            ),
                            'recent_posts_count' => array(
                                'type' => 'text',
                                'label' => __('No. of Recent Posts', 'stronghold'),
                                'sanitize_callback' => 'absint',
                            ),
                        ),
                    ),
                    'blog' => array(
                        'title' => __('Blog', 'stronghold'),
                        'description' => __('Blog related options', 'stronghold'),
                        'fields' => array(
                            'featured_image' => array(
                                'type' => 'checkbox',
                                'label' => __('Enable Featured Image', 'stronghold'),
                                'default' => 1,
                                'sanitize_callback' => 'boolean',
                            ),
                            'single_featured_image' => array(
                                'type' => 'checkbox',
                                'label' => __('Enable Single Post Featured Image', 'stronghold'),
                                'default' => 1,
                                'sanitize_callback' => 'boolean',
                            ),
                        ),
                    ),
                )
            ),
        )
    );

function boolean($value) {
    if(is_bool($value)) {
        return $value;
    } else {
        return false;
    }
}

function breadcrumb_char_choices($value='') {
    $choices = array(
        '1' => '&raquo;',
        '2' => ' / ',
        '3' => ' > '
    );

    if( in_array($value, $choices)) {
        return $value;
    } else {
        return '1';
    }
}